package com;
class Animal {
    public String name;
    public int age;

    static {
        System.out.println("Animal static{}");
    }

    {
        System.out.println("Animal {}");
    }
    public Animal(){
        System.out.println("Animal()");
    }
    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("带有2个参数的构造方法！");
    }

    public void eat() {
        System.out.println(name+" 正在吃饭！");
    }
}

class Dog extends Animal {
    static {
        System.out.println("Dog static{}");
    }

    {
        System.out.println("Dog {}");
    }

    public Dog() {
        //super();//编译器会帮你默认加上的
        System.out.println("DOG()");
    }
    public Dog(String name, int age) {
        super(name,age);
        //super("七月",10);//显示的调用父类的构造方法，帮助父类的成员进行初始化
    }
    public void wangwang() {
        System.out.println(name+"汪汪叫！");
    }
}
class Cat extends Animal {
    public Cat() {
        super();
    }

    public int size;
    public Cat(String name, int age, int size) {
        super(name,age);
        this.size = size;
    }
//    public Cat(String name, int age) {
//        super(name,age);
//        this(1,2,3);
//    }

    public void miaomiao() {
        System.out.println(name+"正在喵喵叫！");
    }
}
public class Test3 {
    public static void main(String[] args) {
        Dog dog = new Dog();
        System.out.println("=======");
        Dog dog1 = new Dog();

    }
    public static void main1(String[] args) {
        Dog dog = new Dog();
        dog.name = "坦克";
        dog.eat();
        dog.wangwang();

        Cat cat = new Cat();
        cat.name = "小咪";
        cat.eat();
        cat.miaomiao();
    }
}
